///////////////////////////////////////////////////
/// tototoy Code
/// $Id: base.cc 35 2009-10-12 10:04:29Z tonyjobmails $
/// $Date: 2009-10-12 10:04:29 +0000 (Mon, 12 Oct 2009) $
/// $Author: tonyjobmails $
/// $Revision: 35 $
/// E-mail: tonyjobmails@gmail.com
/// filename: base.cc
/// function: 基本类型定义
///////////////////////////////////////////////////

#include "base.h"

namespace base_fun
{
	///////////////////////////////////////////////////////////////////
	/// 随机数
	/// 从min和max之间取随机数
	int rand_between(int _min, int _max)
	{
		if(_min == _max)
			return _min;
		else if(_min < _max)
			return _min + (((double)_max - (double)_min + 1.0) * rand()) / (RAND_MAX + 1.0);
		else
			return _max + (((double)_min - (double)_max + 1.0) * rand()) / (RAND_MAX + 1.0);
	}
	///////////////////////////////////////////////////////////////////
};
/// Bonzer Splitted Line
void split_line(bool eng)
{
	std::string char_eng = "[Bonzer-Splitted-Line]";
	std::string char_chn = "[华丽的分割线]";
	std::string fline = "";
	std::string bline = "";

	srand(time(NULL));
	int num = base_fun::rand_between(0, 5);
	switch(num)
	{
		case 0:
			{
				fline = "<$-#############################-$>";
				bline = "<$-#############################-$>";
			}
			break;
		case 1:
			{
				fline = "<★-※※※※※※※※##`(*∩_∩*)′`##※※※※※※※※-★>";
				bline = "<★-※※※※※※※※##`(*∩_∩*)′`##※※※※※※※※-★>";
			}
			break;
		case 2:
			{
				fline = "<★☆★☆★☆★【♬♪♩♭♪♬♩♭♪♩】★☆★☆★☆★>";
				bline = "<★☆★☆★☆★【♬♪♩♭♪♬♩♭♪♩】★☆★☆★☆★>";
			}
			break;
		case 3:
			{
				fline = "<ღღღ-░░░┢┦aΡｐy░じ♡ve░┢┦aΡｐy░░░-ღღღ>";
				bline = "<ღღღ-░░░┢┦aΡｐy░じ♡ve░┢┦aΡｐy░░░-ღღღ>";
			}
			break;
		case 4:
			{
				fline = "<卐-┻┳═一☆☆☆☆♠♥♣♦☆☆☆☆┻┳═一-卐>";
				bline = "<卐-┻┳═一☆☆☆☆♠♥♣♦☆☆☆☆┻┳═一-卐>";
			}
			break;
		case 5:
			{
				fline = "『 www.totototototototototototoy.com 』";
				bline = "『 www.totototototototototototoy.com 』";
			}
			break;
		default:
			{
				fline = "『 www.totototototototototototoy.com 』";
				bline = "『 www.totototototototototototoy.com 』";
			}
			break;
	}

	if(eng)
		std::cout << std::endl << fline << char_eng << bline << std::endl << std::endl;
	else
		std::cout << std::endl << fline << char_chn << bline << std::endl << std::endl;
}

